package com.yykj.tencent.im.server.bean.message;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.yykj.tencent.im.client.message.MsgType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 语音消息元素
 *
 */
@Data
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class TIMSoundMsgElement extends TIMMsgElement {
    @JsonProperty("MsgContent")
    private SoundMsgContent msgContent;

    public TIMSoundMsgElement(SoundMsgContent msgContent) {
        super(MsgType.TIM_SOUND_ELEM);
        this.msgContent = msgContent;
    }

    public TIMSoundMsgElement(String url, String uuid, Integer size, Integer second, Integer downloadFlag) {
        this(new SoundMsgContent(url, uuid, size, second, downloadFlag));
    }

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class SoundMsgContent {
        @JsonProperty("Url")
        private String url;

        @JsonProperty("UUID")
        private String uuid;

        @JsonProperty("Size")
        private Integer size;

        @JsonProperty("Second")
        private Integer second;

        @JsonProperty("Download_Flag")
        private Integer downloadFlag;
    }
}
